package idea.mybatis.db;

import javax.sql.DataSource;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;

/**
 * Created by Timothy on 2017/3/29.
 */
@MapperScan("idea.mybatis.db.mapper*")
@ImportResource(locations = { "classpath:generator_web_db.xml" })
@SpringBootApplication
public class ConsoleApplication implements CommandLineRunner {

	@Autowired
	DataSource dataSource;

	public static void main(String[] args) {
		SpringApplication app = new SpringApplication(ConsoleApplication.class);
		app.setBannerMode(Banner.Mode.OFF);
		app.run(args);
		// SpringApplication.run(Application.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		// 输出所使用的数据库连接池
		System.out.println("DATASOURCE = " + dataSource);
	}
}
